import 'package:flutter/material.dart';

class Line extends StatefulWidget {
  final String title;
  final bool active;
  final String timer;

  Line(
      {Key key,
      this.title = '合肥中心合肥中心合肥中心合肥中心合肥中心合肥中心合肥中心合肥中心合肥中心合肥中心',
      this.active = true,
      this.timer = '2022.9.6'})
      : super(key: key);

  @override
  _LineState createState() => _LineState();
}

class _LineState extends State<Line> {
  buildCircular(bool active) {
    return Container(
      child: active
          ? Image.asset(
              'images/my/circular.png',
              width: 17,
              height: 17,
            )
          : Image.asset(
              'images/my/circular2.png',
              width: 17,
              height: 17,
            ),
    );
  }

  Widget buildContent(String title, String timer) {
    return Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Wrap(
            children: [
              Text(
                title,
              )
            ],
          ),
          Container(
            child: Text(
              timer,
              style: TextStyle(
                  fontSize: 10, color: Color.fromRGBO(153, 153, 153, 1)),
            ),
          ),
        ],
      ),
    );
  }

  buildLine() {
    return Expanded(
      child: Container(
        margin: EdgeInsets.only(top: 1),
        width: 0.3,
        color: Colors.black,
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return IntrinsicHeight(
      child: Container(
        padding: EdgeInsets.all(20),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Column(
              children: [buildCircular(widget.active), buildLine()],
            ),
            Expanded(
              child: Container(
                margin: EdgeInsets.only(left: 20),
                padding: EdgeInsets.only(bottom: 10),
                child: buildContent(widget.title, widget.timer),
              ),
            )
          ],
        ),
      ),
    );
  }
}
